@isTest
private class {{classname}}Test {
{{#operations}}
  {{#operation}}
    /**
     * {{summary}}
     *
     * {{notes}}
     */
    @isTest
    private static void {{operationId}}Test() {
        HttpResponse res = new HttpResponse();
    {{#restfulCreate}}
        res.setStatusCode(201);
        res.setStatus('Created');
    {{/restfulCreate}}
    {{^restfulCreate}}
        res.setStatusCode(200);
        res.setStatus('OK');
    {{/restfulCreate}}
        Test.setMock(HttpCalloutMock.class, new SwaggerResponseMock(res));
      {{#hasParams}}

        Map<String, Object> params = new Map<String, Object>{
          {{#allParams}}
            '{{paramName}}' => {{{example}}}{{#hasMore}},{{/hasMore}}
          {{/allParams}}
        };
      {{/hasParams}}

        {{classPrefix}}Client client;
        {{classname}} api;
      {{#returnType}}
        {{{returnType}}} response;
        {{{returnType}}} expectedResponse;
      {{/returnType}}

    {{#authMethods}}
        client = new {{classPrefix}}Client();
        api = new {{classname}}(client);{{#isApiKey}}
        ((Swagger.ApiKeyAuth){{/isApiKey}} client.getAuthentication('{{name}}');
      {{#isApiKey}}
            client.setApiKey('foo-bar-api-key');
      {{/isApiKey}}
      {{#examples}}

        res.setHeader('Content-Type', '{{contentType}}');
        res.setBody('{{{example}}}');
        expectedResponse = {{{deserializedExample}}};
        response = ({{{returnType}}}) api.{{operationId}}({{#hasParams}}params{{/hasParams}});
        System.assertEquals(expectedResponse, response);
      {{/examples}}
      {{^examples}}

        api.{{operationId}}({{#hasParams}}params{{/hasParams}});
      {{/examples}}
    {{/authMethods}}
    {{^authMethods}}
        api = new {{classname}}(new {{classPrefix}}Client());
      {{#examples}}

        res.setHeader('Content-Type', '{{contentType}}');
        res.setBody('{{{example}}}');
        expectedResponse = {{{deserializedExample}}};
        response = ({{{returnType}}}) api.{{operationId}}({{#hasParams}}params{{/hasParams}});
        System.assertEquals(expectedResponse, response);
      {{/examples}}
      {{^examples}}

        api.{{operationId}}({{#hasParams}}params{{/hasParams}});
      {{/examples}}
    {{/authMethods}}
    }
    {{#hasMore}}

    {{/hasMore}}
  {{/operation}}
{{/operations}}
}